"""
URL configuration for backed project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from . import auth  # 保留旧的 auth.py 作为备用

urlpatterns = [
    path('admin/', admin.site.urls),
    
    # 用户认证接口 - 使用 JWT 认证
    path('creation/auth/', include('users.urls')),
    
    # 保留旧的 Session 认证接口作为备用
    path('creation/session/login', auth.login_view, name='session_login'),
    path('creation/session/register', auth.register_view, name='session_register'),
    path('creation/session/logout', auth.logout_view, name='session_logout'),
    path('creation/session/info', auth.info_view, name='session_user_info'),
]

# 开发环境下提供媒体文件访问
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
